<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>CC防护设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" charset="utf-8" src="/static/js/jquery-1.11.3.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="/admin/welcomepage">首页</a>
       <a href="javascript:window.location.reload();">
          <cite>CC防护设置</cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:void(0);" onclick="reload_iframe();" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i>
    </a>
</div>
<div class="x-body">
    <blockquote class="layui-elem-quote">
        提示:此处设置平台CC防护,以下设置均为每IP统计量,系统只计算动态请求次数,防护记录为每5秒更新一次,人机验证供应商:www.vaptcha.com
    </blockquote>
    <fieldset class="layui-elem-field layui-col-md11 " style="margin-top: 10px;">
        <legend>CC防护设置</legend>
        <div style="height: 20px;"></div>
        <form class="layui-form layui-col-md-offset1" id="cededejlkjbgdiuwd" onsubmit="return false;">
            <input type="hidden" name="id" th:value="${config.id}">
            <div class="layui-form-item">
                <div class="layui-inline layui-col-md5">
                    <label class="layui-form-label">防护状态:</label>
                    <div class="layui-input-inline">
                        <select name="status">
                            <option value="0" th:selected="${config.status ==0}">关闭</option>
                            <option value="1" th:selected="${config.status ==1}">开启</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline layui-col-md5">
                    <label class="layui-form-label">记录日志:</label>
                    <div class="layui-input-inline">
                        <select name="recordStatus">
                            <option value="0" th:selected="${config.recordStatus ==0}">关闭</option>
                            <option value="1" th:selected="${config.recordStatus ==1}">打开</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline layui-col-md5">
                    <label class="layui-form-label">时间(秒):</label>
                    <div class="layui-input-inline">
                        <input type="number" name="timeLong" th:value="${config.timeLong}" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline layui-col-md5">
                    <label class="layui-form-label">最大QPS:</label>
                    <div class="layui-input-inline">
                        <input type="number" th:value="${config.reqCount}" name="reqCount" autocomplete="off"
                               class="layui-input ">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline layui-col-md5">
                    <label class="layui-form-label">人机验证VID:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="capVid" th:value="${config.capVid}" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline layui-col-md5">
                    <label class="layui-form-label">人机验证KEY:</label>
                    <div class="layui-input-inline">
                        <input type="text" th:value="${config.capKey}" name="capKey" autocomplete="off"
                               class="layui-input ">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-col-md-offset4" onclick="grzl_submit()">保存设置</button>
                </div>
            </div>
        </form>
    </fieldset>
    <fieldset class="layui-elem-field layui-col-md11 layui-field-title" style="margin-top: 10px;">
        <legend>CC防护记录</legend>
        <div style="height: 20px;"></div>
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so" action="/admin/cc/list" id="ajaxForm" onsubmit="load_msg()">
                <input type="text" name="url" placeholder="访问URL" autocomplete="off" th:value="${url}"
                       class="layui-input">
                <input type="text" name="ip" placeholder="IP地址" autocomplete="off" th:value="${ip}"
                       class="layui-input">
                <button class="layui-btn" type="submit"><i class="layui-icon">&#xe615;</i></button>
            </form>
        </div>
        <xblock>
            <button class="layui-btn" onclick="member_del_all()"><i class="layui-icon"></i>清空记录
            </button>
            <span class="x-right" style="line-height:40px" th:text="'共有数据：'+${bean.total}+' 条'"></span>
        </xblock>
        <th:block th:fragment="pageNode">
            <div id="dewdewfef">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>IP</th>
                        <th>URL</th>
                        <th>方式</th>
                        <th>QPS</th>
                        <th>时间</th>
                        <th>操作</th>
                    </thead>
                    <tbody>
                    <tr th:each="o,state:${bean.list}">
                        <td th:text="${o.id}"></td>
                        <td th:text="${o.ip}"></td>
                        <td th:text="${o.url}"></td>
                        <td th:text="${o.method}"></td>
                        <td th:text="${o.reqCount}"></td>
                        <td th:text="${#dates.format(o.optTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                        <td class="td-manage">
                            <a title="查看详情" th:onclick="x_admin_show('查看详情','/admin/cc/view?id=[(${o.id})]');"
                               href="javascript:void(0);">
                                <i class="layui-icon">&#xe63c;</i>
                            </a>
                            <a title="删除" th:onclick="member_del(this,'[(${o.id})]');"
                               href="javascript:void(0);">
                                <i class="layui-icon">&#xe640;</i>
                            </a>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <div class="page"
                     th:include="~{include/page2.html::page(${bean},'/admin/cc/list','ajaxForm','dewdewfef')}">
                </div>
                <script>
                    $(function () {
                        layui.use('laydate', function () {
                            var laydate = layui.laydate;
                            //执行一个laydate实例
                            laydate.render({
                                elem: '#start' //指定元素
                            });
                            //执行一个laydate实例
                            laydate.render({
                                elem: '#end' //指定元素
                            });
                        });
                    });

                    function member_del(obj, id) {
                        layer.confirm('确认要删除吗？', function (index) {
                            layer.load(0);
                            $.post("/admin/cc/delete",
                                {"id": id},
                                function (data) {
                                    layer.closeAll();
                                    layer.msg(data.msg, {icon: 1, time: 800});
                                    $(obj).parents("tr").remove();
                                    window.location.reload();
                                }, "json");
                        });
                    }

                    function member_del_all() {
                        layer.confirm('确认要清空记录吗？', function (index) {
                            layer.load(0);
                            $.post("/admin/cc/deleteAll",
                                {"t": new Date().getTime()},
                                function (data) {
                                    layer.closeAll();
                                    layer.alert(data.msg, {icon: 6}, function () {
                                        window.location.reload();
                                    });
                                }, "json");
                        });
                    }

                    function grzl_submit() {
                        var data = $("#cededejlkjbgdiuwd").serialize();
                        layer.load(0);
                        $.post("/admin/cc/update_config",
                            data,
                            function (data) {
                                layer.closeAll();
                                layer.alert(data.msg, {icon: 6}, function () {
                                    window.location.reload();
                                });
                            }, "json");
                    }

                    window.onload = close_loading_msg();

                    function reload_iframe() {
                        parent.obj = parent.layer.load(0);
                        location.replace(location.href);
                    }

                </script>
            </div>
        </th:block>
    </fieldset>
</div>
</body>
</html>






